import reqt from "@/request/reqt";
import reqMk from "@/request/reqMk";

export const reqcList = () => {
	return reqt.get(`/product/getBaseCategoryList`);
};

//2. 请求banner的列表(MOCK请求)
export const reqBannerList = () => {
	return reqMk.get("/banner/list");
};

//3. 请求floor的列表(MOCK请求)
export const reqFloorList = () => {
	return reqMk.get("/floor/list");
};

//4. 请求搜索页面数据
export const reqSearchList = (searchParams) => {
	return reqt.post(`/list`, searchParams);
};

// 5.请求详情页数据
export const reqDetailInfo = (skuId) => {
	return reqt.get(`/item/${skuId}`);
};

// 6.添加购物车或者修改购物车商品数量
export const addOrupdateShopCart = (skuId, skuNum) => {
	return reqt.post(`/cart/addToCart/${skuId}/${skuNum}`);
};

//7.获取购物车数据
export const reqShopCartList = () => {
	return reqt.get(`/cart/cartList`);
};

//8. 请求修改购物车的某个商品的选中状态
export const reqCheckCart = (skuID, isChecked) => {
	return reqt.get(`/cart/checkCart/${skuID}/${isChecked}`);
};

//9. 请求删除购物车的某个商品
export const reqDeleteCart = (skuId) => {
	return reqt.delete(`/cart/deleteCart/${skuId}`);
};

//10. 控制购物车所有商品的状态
export const reqAllChecked = (isChecked, skuIdList) => {
	return reqt.post(`/cart/batchCheckCart/${isChecked}`, skuIdList);
};

//11. 批量删除购物车数据
export const reqDeleteAll = (skuIdList) => {
	return reqt.delete(`/cart/batchDeleteCart`, {
		data: skuIdList,
	});
};

//12. 获取注册验证码
export const reqVerifyCode = (phone) => {
	return reqt.get(`/user/passport/sendCode/${phone}`);
};

//13. 注册请求
export const reqRegister = (userInfo) => {
	return reqt.post(`/user/passport/register`, userInfo);
};

//14. 登录请求
export const reqLogin = (userInfo) => {
	return reqt.post(`/user/passport/login`, userInfo);
};

//15.请求用户信息
export const reqUserInfo = () => {
	return reqt.get(`/user/passport/auth/getUserInfo`);
};

//16.退出登录
export const reqLogout = () => {
	return reqt.get(`/user/passport/logout`);
};

//17.请求用户地址
export const reqUserAddress = () => {
	return reqMk.get(`/address/list`);
};

//18.请求交易页的信息
export const reqTradeInfo = () => {
	return reqt.get(`/order/auth/trade`);
};

//19.提交订单请求
export const reqSubmitOrder = (tradeNo, orderInfo) => {
	return reqt.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, orderInfo);
};

//20.获取支付详情
export const reqPayInfo = (orderId) => {
	return reqt.get(`/payment/weixin/createNative/${orderId}`);
};

//21.获取支付成功的信息
export const reqPayStatus = (orderId) => {
	return reqt.get(`/payment/weixin/queryPayStatus/${orderId}`);
};

//22.获取订单的分页列表
export const reqOrderList = (page, limit) => {
  return reqt.get(`/order/auth/${page}/${limit}`);
};
